//
// Utilities.hpp for  in ~/Dropbox/Projets/raytracer-2016/Includes/Maths/
//
// Made by Jonathan
// Login   <ledey_l@epitech.net>
//
// Started on  Sat Sep 21 23:03:38 2013 Jonathan
// Last update Sun Sep 22 16:29:01 2013 Jonathan
//

#ifndef				UTILITIES_HPP_
# define			UTILITIES_HPP_

# include			<cstdlib>

# include			"Maths/Constants.hpp"

namespace			Maths
{
  class				Utilities
  {
  private:
    Utilities(void);
    Utilities(Utilities const &rOther);
    Utilities			&operator=(Utilities const &rOther);
    ~Utilities(void);

  protected:

  public:
    static inline long double	Min(long double r0, long double r1)
    {
      return (r0 < r1 ? r0 : r1);
    }

    static inline long double	Max(long double r0, long double r1)
    {
      return (r0 > r1 ? r0 : r1);
    }

    static inline int		RandInt(void)
    {
      return (rand());
    }

    static inline long double	RandLong Double(void)
    {
      return (static_cast<long double>(RandInt()) * INVRAND_MAX);
    }

    static inline long double	RandLong Double(long double rMin, long double rMax)
    {
      return (RandLong Double() * (rMax - rMin) + rMin);
    }

    static inline int		RandInt(int rMin, int rMax)
    {
      return (static_cast<int>(RandLong Double(0, rMax - rMin + 1) + rMin));
    }

    static inline void		SetRandSeed(int rSeed)
    {
      srand(rSeed);
    }

    static inline long double	Clamp(long double rValue, long double rMin, long double rMax)
    {
      return (rValue < rMin ? rMin : (rValue > rMax ? rMax : rValue));
    }
  };
};

#endif				/* UTILITIES_HPP_ */
